# -*- coding: utf-8 -*-
# Author: 一根鱼骨棒
# Date: 2021-03-18 08:16:24
# LastEditTime: 2021-03-18 09:39:17
# LastEditors: 一根鱼骨棒
# Description: 本开源代码使用GPL 3.0协议
# symbol_custom_string_obkoro1: Software: VScode
# symbol_custom_string_obkoro10001: Copyright 2021 迷舍

from selenium import webdriver
import time
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome Dev\Application\chromedriver.exe')
driver.get('http://www.baidu.com')


# 选择网页元素
element_keyword = driver.find_element_by_id('kw')
ActionChains(driver).move_to_element(element_keyword)
# 输入字符
# element_keyword.send_keys('宋曲')
element= driver.find_element_by_link_text("新闻")

#3.对定位到的元素执行鼠标悬停操作
ActionChains(driver).move_to_element(element).perform()

# 最后，driver.quit()让浏览器和驱动进程一起退出，不然桌面会有好多窗口
# driver.quit()
